/*
 * @Author: rogi
 * @Date: 2022-07-18 08:45:13
 * @LastEditTime: 2022-12-05 15:22:57
 * @LastEditors: rogi
 * @Description: 描述
 */
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';



// https://vitejs.dev/config/
export default defineConfig({
  base:'/',
  plugins: [vue(), vueJsx(), viteCommonjs(),
  createSvgIconsPlugin({
    // 指定要缓存的文件夹
    iconDirs: [path.resolve(process.cwd(), 'src/assets/icon')],
    // 指定symbolId格式
    symbolId: '[name]',
    
  })
  ],
  resolve: {
    alias: {
      '@': '/src',
      '%': '/scripts'
    }
  },
  transpileDependencies: true,
  runtimeCompiler: true,
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'scss',
      patterns: []
    }
  },
  // build:{
  //   sourcemap:true
  // },
  cors: true,
  open: true,
  hmr: true,
  
  server: {
    host:'0.0.0.0',
    port: 3002,
    watch: {
      usePolling: true
    },
    proxy: {
      '/jeecg-boot': {
        target: 'http://192.168.1.23:8080/',
        changeOrigin: true
      },

    }
  }
})
